function Open-Question
{
    Param (
        [Parameter(Mandatory = $true)][string]$Question,
        [Parameter(Mandatory = $true)][ValidateScript({ $_.Count -gt 0 })][array]$Options
    )
    $WarningMessage = $Null

    # Show user the only option.
    if ($Options.Count -eq 1) {
        Write-Host $Question
        Write-Host "'$($Options[0])' is the only available option."
        Read-Host -Prompt "Press 'enter' to select and continue" | Out-Null
        return $Options[0]
    }

    # Define possible answer interval.
    $Min = 0
    $Max = $Options.Count - 1
    $AllowedAnswers = $Min..$Max

    # Write question and possible answers.
    while ($true) {
        # Display warning message if last round in the loop failed (invalid answer).
        if ($WarningMessage) {
            Write-Host -ForegroundColor 'RED' -BackgroundColor 'BLACK' $WarningMessage
            Start-Sleep -Milliseconds 100
        }

        # Ask question.
        Write-Host $Question
        $Index = 0
        $Options | ForEach-Object { Write-Host "$($Index) - $($Options[$Index])" ; $Index++ }
        # Prompt user for an answer.
        $Answer = Read-Host -Prompt "Which option do you select? ($Min-$Max)?"
        # Validate answer.
        try {
            $Answer = [int]$Answer
            if ($Answer -in $AllowedAnswers) {
                break
            } else {
                $WarningMessage = 'Invalid choice. Choose again...'
            }
        }
        catch {
            $WarningMessage = 'Invalid choice. Choose again...'
        }
    }

    # Return the value.
    return $Options[$Answer]
}